// Teste para os heaps
#include <heap.h>
#include <stdio.h>
#include <stdlib.h>

/** Compara inteiros
 */
static int int_cmp (void * v1, void *v2) {
	int *i1 = (int *) v1;
	int *i2 = (int *) v2;
	return (*i1 - *i2);
}

int main () {
	int is [] = {8,5,6,3,9,4,0,1,7,2,4};
	int i;
	Heap heap = heap_new (int_cmp);
	
	// Põe 11 valores no heap

	for (i = 0; i < 11; i++) {
		heap_push (heap, is + i);
	}
	printf("As proximas duas linhas devem ser iguais:\n");
	printf("01234456789\n");
	int *v;
	while ((v = (int *)heap_pop (heap)) != NULL)
		printf ("%d",  *v);
	printf("\n");
	heap_delete (heap);
	return 0;
}

